fix(oauth): bind update access to selected credential - #6999
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Workflow credential selectors, tool-input selectors, and knowledge connector cards pass Tests cover modal draft ordering/errors, connector UI behavior, and draft processing for Slack reconnect via an exact draft. Reviewed by Cursor Bugbot for commit fe47b61. Configure here. |
Greptile SummaryThe PR binds OAuth reauthorization to the exact selected credential through a pending credential draft and fails closed when a knowledge connector’s stored credential cannot be resolved.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/components/connect-oauth-modal/connect-oauth-modal.tsx | Creates a credential-bound draft before reauthorization and forwards its identifier into the OAuth launch. |
| apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/connectors-section/connectors-section.tsx | Resolves the connector’s stored credential, uses its exact provider and identity for reconnect, and fails closed when it cannot be resolved. |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx | Binds workflow credential reauthorization to the selected credential and closes stale reconnect state after credential resolution. |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/tools/credential-selector.tsx | Applies the exact-credential reconnect path to tool-input credential selection. |
| apps/sim/lib/credentials/draft-processor.test.ts | Verifies that an exact Slack draft reconnects its bound credential regardless of the returned account identity. |
Sequence Diagram
sequenceDiagram
participant User
participant Selector as Credential selector
participant Modal as OAuth modal
participant Draft as Credential draft API
participant OAuth as OAuth provider
participant Callback as OAuth callback
User->>Selector: Update access
Selector->>Modal: Reauthorize exact credential
Modal->>Draft: Create draft with provider and credential ID
Draft-->>Modal: Return draft ID
Modal->>OAuth: Launch OAuth with draft ID
OAuth-->>Callback: Return updated provider account
Callback->>Draft: Process exact credential draft
Draft-->>User: Reconnect selected credential
Reviews (7): Last reviewed commit: "fix(oauth): refresh resolved connector c..." | Re-trigger Greptile
|
bugbot run |
Screen.Recording.2026-08-22.at.6.38.59.PM.mov |
|
@cursor review |
e0dc30f to
7899a71
Compare
4f1ee9f to
7022b86
Compare
7022b86 to
4a96328
Compare
4a96328 to
fe47b61
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit fe47b61. Configure here.
Summary
Bind existing-credential reauthorization to the exact selected OAuth credential before redirecting. This makes the callback use the established draft reconnect path instead of relying on provider account-ID matching, which can leave a legacy Slack credential pointing at its old account after Update access.
The change is provider-agnostic and applies to workflow credential selectors, tool-input credential selectors, and knowledge connectors. Provider-only Copilot reauthorization remains unchanged.
Type of Change
Testing
bun run --cwd apps/sim test 'app/workspace/[workspaceId]/components/connect-oauth-modal/connect-oauth-modal.test.tsx' lib/credentials/draft-processor.test.ts lib/credentials/draft-hooks.test.ts(18 tests passed)bun run --cwd apps/sim type-checkchat:write:Additional permissions requiredandUpdate access.Connect Slackpermission modal rendered without visual regressions.POST /api/credentials/draftcreated draft7e70aa5f-afc3-42df-95b4-5ed144dd5748for workspace6762b941-0cb8-4787-918d-c8ac76d501b4, providerslack, selected credentialea789bd4-17c9-4a8f-80fd-123456789004, and display nameLocal incomplete Slack.POST /api/auth/oauth2/linkwas attempted. The local run used port 3001 because port 3000 was occupied by another worktree, so Better Auth rejected the local origin before any Slack redirect. The focused modal test separately verifies that the returned draft ID is forwarded into this link call.No live Slack OAuth flow was completed, no real grant or credential was modified, and no provider configuration was changed.
Checklist
Screenshots/Videos
Not applicable: no visual changes are intended. Chrome verification confirmed the existing warning and modal presentation.